package com.ttsx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttsx.mapper.UserAddressMapper;
import com.ttsx.pojo.entity.User;
import com.ttsx.pojo.entity.UserAddress;
import com.ttsx.service.UserAddressService;
import com.ttsx.core.common.util.WebUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author lucky
* @description 针对表【ttsx_user_address(用户地址表)】的数据库操作Service实现
* @createDate 2025-03-01 17:41:06
*/
@Service
public class UserAddressServiceImpl extends ServiceImpl<UserAddressMapper, UserAddress>
    implements UserAddressService{

    @Override
    public List<UserAddress> getByUserId() {
        User user = (User) WebUtils.getRequest().getSession().getAttribute("user");
        LambdaQueryWrapper<UserAddress> lqw = new LambdaQueryWrapper<>();
        lqw.eq(UserAddress::getUserId, user.getId());

        return baseMapper.selectList(lqw);
    }
}




